<template>
	<!-- 项目公共规划配置管理 -->
	<div class="">
		<tableIndex
			ref="tableRef"
			:tableData="tableData"
			:tableHead="tableHead"
			:isIndex="true"
			:isSelection="true"
			:isRadio="false"
			:fields="state.fields"
			:height="500"
			:page="page"
			@searchList="searchList"
			@page-change="pageChange"
		>
			<template #btns>
				<div style="float: right">
					<el-button
						size="small"
						plain
						class="update"
						@click="addProjectHandler"
						><svg-icon icon-class="export" /> 新增项目自定义配置</el-button
					>
				</div>
			</template>

			<template #operate>
				<el-table-column label="操作" width="400" align="center" fixed="right">
					<template #default="{ row }">
						<el-button
							size="small"
							class="end"
							type="primary"
							@click="projectStageHandler(row)"
							>项目阶段</el-button
						>
						<el-button
							v-if="!row.meetingApplyStatus"
							size="small"
							class="look"
							type="primary"
							@click="projectProposal(row)"
							>立项议题</el-button
						>
					</template>
				</el-table-column>
			</template>
		</tableIndex>
	</div>
</template>

<script setup>
import { ref, reactive } from "vue";
import tableIndex from "@/components/table";
import { ElButton, ElMessage, ElMessageBox } from "element-plus";
import { useRouter } from "vue-router";
const router = useRouter();
let state = reactive({
	fields: [
		// { key: "projectName", label: "项目名称", type: "input" },
		{
			key: "projectTypeId",
			label: "业务类型",
			type: "select",
			options: {
				list: [
					{
						label: "全部",
						value: "",
					},
					{
						label: "投资类",
						value: 1,
					},
					{
						label: "设计类",
						value: 2,
					},
					{
						label: "开发类",
						value: 3,
					},
					{
						label: "运营类",
						value: 4,
					},
					{
						label: "公共类",
						value: 5,
					},
				],
			},
		},
	],
});
const tableHead = reactive([
	{
		prop: "responsibleDepartmentName",
		label: "项目发起部门",
	},
	{
		prop: "typeName",
		label: "项目类型",
	},
	{
		prop: "streetName",
		label: "所属街道",
	},
	{
		prop: "responsibleUserName",
		label: "发起责任人",
	},
	{
		prop: "submitCompany",
		label: "报送单位",
	},
]);
const tableData = reactive([]);
const page = reactive({
	page: 1,
	pageSize: 10,
	total: 0,
});

//搜索查询
const searchList = (e) => {
	getPage(e);
};

//分页
const pageChange = (e) => {
	page.page = e.page;
	page.pageSize = e.limit;

	getPage();
};

const getPage = (e) => {
	let data = {
		pageNum: page.page,
		pageSize: page.pageSize,
		param: {
			...e,
			prepareStatus: -1,
		},
	};

	console.log(data);
	/* 	projectConfigApi.getProjectPage(data).then((res) => {
		if (res.code == 200) {
			tableData.value = res.data.content;
			page.total = res.data.totalSize;
			console.log(tableData);
		}
	}); */
};

const addProjectHandler = () => {
	router.push({
		// path: `/constructionProjectManage/CustomConfiguration/id=${}&type=add`,
		path: `/constructionProjectManage/CustomConfiguration/type=add`,
	});
};
const handel = () => {};
</script>
<style lang="scss" scoped></style>
